import com.java.demo.Articles;
import com.java.demo.User;
import com.java.demo.mode.ArticleInfo;
import com.java.demo.service.UConfig;
import com.java.example.Teacher;
import com.java.demo.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-07-18
 * Time: 22:55
 */
public class App {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        //默认小驼峰原类名,（首字母大写第二个小写）
//        User user = context.getBean("user", User.class);
        //自定义
//        User user = context.getBean("userinfo", User.class);
//        user.sayHi();
//        UserService userService = context.getBean("userService", UserService.class);
//        userService.hi();

        //example和demo是平级目录不能扫描到
//        Teacher teacher = context.getBean("teacher", Teacher.class);
//        teacher.hi();

        //大驼峰类名（首字母大写第二个也大写）
        //jdk的规则就是这样
//        UConfig uConfig = context.getBean("UConfig", UConfig.class);
////        UConfig uConfig = context.getBean("uConfig", UConfig.class);错误
//        uConfig.hi();

//        Articles articles = context.getBean("article", Articles.class);
        //报错，必须和方法名相同
//        ArticleInfo articleInfo = context.getBean("articleInfo", ArticleInfo.class);
        //自定义名称
        ArticleInfo articleInfo = context.getBean("article", ArticleInfo.class);
        //正确
//        ArticleInfo articleInfo = context.getBean("article", ArticleInfo.class);
//        System.out.println(articles.article().toString());
        System.out.println(articleInfo.toString());
    }
}
